python depth first search tree